{extend name="Public:base" /}
{block name="main"}
<main>
	<!-- breadcrumb-area-start -->
	<!-- <section class="breadcrumb-area" data-background="img/bg/page-title.png">
		<div class="container">
			<div class="row">
				<div class="col-xl-12">
					<div class="breadcrumb-text text-center">
						<h1>Our Shop</h1>
						<ul class="breadcrumb-menu">
							<li><a href="index.html">home</a></li>
							<li><span>shop details</span></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</section>-->
	<!-- breadcrumb-area-end -->

	<!-- shop-area start -->
	<section class="shop-details-area pt-100 pb-100">
		<div class="container">
			<div class="row">
				<div class="col-xl-6 col-lg-4">
					<div class="product-details-img mb-10">
						<div class="tab-content" id="myTabContentpro">
							<div class="tab-pane fade show active" id="home" role="tabpanel">
								<div class="product-large-img">
									<img src="http://hawkmatic.shop/{$goods.icon}" alt="">
								</div>
							</div>
							<!-- <div class="tab-pane fade" id="profile" role="tabpanel">
								<div class="product-large-img">
									<img src="img/product/pro2.jpg" alt="">
								</div>
							</div>
							<div class="tab-pane fade" id="profile1" role="tabpanel">
								<div class="product-large-img">
									<img src="img/product/pro3.jpg" alt="">
								</div>
							</div> -->
						</div>
					</div>
					<div class="shop-thumb-tab mb-30">
						<ul class="nav" id="myTab2" role="tablist">
							{volist name="goods.media" id="vo"}
							<li class="nav-item">
								<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab"
									aria-selected="true"><img src="http://hawkmatic.shop/{$vo}" alt=""> </a>
							</li>
							{/volist}
						</ul>
					</div>
				</div>
				<div class="col-xl-6 col-lg-8">
					<div class="product-details mb-30 pl-30">
						<!-- <div class="details-cat mb-20">
							<a href="#">decor,</a>
							<a href="#">furniture</a>
						</div> -->
						<h2 class="pro-details-title mb-15">{$goods.name}</h2>
						<div class="details-price mb-20 stock0">
							<span>Not Available Now</span>
						</div>
						<div class="details-price mb-20 stock1">
							<span>price:</span>
							<span>{$goods.money_symbol}{$goods.price}</span>
							<!-- <span class="old-price">$246.00</span> -->
						</div>
						<div class="details-price mb-20 stock1">
							<span>Discount price:</span>
							<span>{$goods.money_symbol}{$goods.wholesale_price}</span>
							<!-- <span class="old-price">$246.00</span> -->
						</div>
						<div class="product-variant">
							<!-- <div class="product-color variant-item">
								<div class="variant-name">
									<span>Colors</span>
								</div>
								<ul class="shop-link shop-color">
									<li><a href="shop.html"><span class="blue"></span></a></li>
									<li><a href="shop.html"><span class="green"></span> </a></li>
									<li><a href="shop.html"><span class="orange"></span> </a></li>
									<li><a href="shop.html"><span class="navy"></span> </a></li>
									<li><a href="shop.html"><span class="pinkish"></span> </a></li>
									<li><a href="shop.html"><span class="vista"></span> </a></li>
								</ul>
							</div>

							<div class="product-size variant-item">
								<div class="variant-name">
									<span>size</span>
								</div>
								<ul class="shop-link shop-size">
									<li><a href="shop.html">xxl </a></li>
									<li class="active"><a href="shop.html">xl </a></li>
									<li><a href="shop.html">lg </a></li>
									<li><a href="shop.html">md </a></li>
									<li><a href="shop.html">sm </a></li>
								</ul>
							</div> -->

							<div class="product-desc variant-item">
								<p>{$goods.body}</p>
							</div>

							<!-- <div class="product-info-list variant-item">
								<ul>
									<li><span>Brands:</span> Hewlett-Packard</li>
									<li><span>Product Code:</span> d12</li>
									<li><span>Reward Points:</span> 100</li>
									<li><span>Stock:</span> <span class="in-stock">In Stock</span></li>
								</ul>
							</div> -->

							<div class="product-action-details variant-item">
								<div class="product-details-action">
									<form id="form-num">
										<div class="plus-minus">
											<div class="cart-plus-minus"><input id="num" type="text" value="1" /></div>
										</div>
										<!-- <button class="details-action-icon" type="submit"><i
												class="fas fa-heart"></i></button>
										<button class="details-action-icon" type="submit"><i
												class="fas fa-hourglass"></i></button> -->
										<div class="details-cart mt-40">
											<a href="{$goods.other_url}" target="_blank">
												<button type="button" class="btn theme-btn" ">purchase now</button>
											</a>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	<!-- shop-area end -->

</main>
{/block}
{block name="script"}
<script>
	window.onload = function() {
		var stock = {$goods.stock};
		if(stock == 0) {
			$(".stock1").css('display', 'none');
		}else {
			$(".stock0").css('display', 'none');
		}
		// getCartList();
	}

	function onLoad() {
		if ($.cookie("token")) {
			if ($.cookie("is_wholesale") == 1) {
				$("#wholesale").css('display', 'block');
				$("#login").css('display', 'none');
			}
		}
	}

	//加入购物车
	function addCart() {
		let ajax = new Services();
		var id = getUrlParam('id');
		var data = {
			goods_id: id,
			num:$("#num").val()
		}
		ajax.postExample("/index/trolley/add", data,
			function(res) {
				if (res.code == 200) {
					TS.successAlert("success");
				} else {
					//错误提示
					TS.errorAlert(res.error);
				}
			},
			function(e) {
				console.log("222", e);
			}
		)
	}
	//方法一：
	        //获取url中的参数
	        function getUrlParam(name) {
	            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
	            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
	            if (r != null) return unescape(r[2]); return null; //返回参数值
	        }
</script>
{/block}
